<?php

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */
 
$title = 'WBCMS - wap blogs CMS';
$root = '../';
include($root.'system/core.php');

if (!$uid) {
    header('Location: http://'.$set['home'].'/login.php');
    exit;
}

if ($user['rights'] != 1) {
    header('Location: http://'.$set['home'].'/index.php');
    exit;
}

include($root.'system/head.php');

$action=htmlspecialchars(trim($_GET['a']));

switch ($action){

default:

$pr = $_GET['id'];

if($pr){

$userset=mysql_result(mysql_query("SELECT count(*) FROM `users` WHERE `id` = '$pr'"), 0);

echo '<div class="title">'.$lang['red_anketa'].'</div>';


if($userset){

if (isset($_POST['submit'])) {
    
$name = isset($_POST['name']) ? trim($_POST['name']) : '';
$mail = isset($_POST['email']) ? trim($_POST['email']) : '';
$vk = isset($_POST['vk']) ? trim($_POST['vk']) : '';
$city = isset($_POST['city']) ? trim($_POST['city']) : '';
$about = isset($_POST['about']) ? trim($_POST['about']) : ''; 
$rights1 = isset($_POST['rights']) ? trim($_POST['rights']) : ''; 

mysql_query("UPDATE `users` SET `name` = '$name' WHERE `id` = '$pr' LIMIT 1");
mysql_query("UPDATE `users` SET `mail` = '$mail' WHERE `id` = '$pr' LIMIT 1");
mysql_query("UPDATE `users` SET `vk` = '$vk' WHERE `id` = '$pr' LIMIT 1");
mysql_query("UPDATE `users` SET `city` = '$city' WHERE `id` = '$pr' LIMIT 1");
mysql_query("UPDATE `users` SET `about` = '$about' WHERE `id` = '$pr' LIMIT 1");
mysql_query("UPDATE `users` SET `rights` = '$rights1' WHERE `id` = '$pr' LIMIT 1");

    echo '<div class="omenu">'.$lang['info_save'].'</div>';
    
}

$user1=mysql_query("SELECT * FROM `users` WHERE `id` = '$pr'");
    $us = mysql_fetch_assoc($user1);
echo '<div class="menu">';
echo '<form action="useredit.php?id='.$pr.'" method="post">';
echo ''.$lang['name'].':<br />';
echo '<input type="name" name="name" maxlength="30" value="'.$us['name'].'" /><br />';
echo ''.$lang['information'].':<br />';
echo '<textarea name="about" />'.$us['about'].'</textarea><br />';
echo 'City:<br />';
echo '<input type="name" name="city" maxlength="60" value="'.$us['city'].'" /><br />';
echo 'Email:<br />';
echo '<input type="name" name="email" maxlength="60" value="'.$us['mail'].'" /><br />';
echo 'vk.com/<br />';
echo '<input type="name" name="vk" maxlength="60" value="'.$us['vk'].'" /><br />';

if($us['rights'] == 1){
echo '<p><div class="info">ADMINISTRATOR<br /><input type="checkbox" name="rights" value="1" checked><small>Yes</small></div></p>';
}else{
 echo '<p><div class="info">ADMINISTRATOR<br /><input type="checkbox" name="rights" value="1"><small>Yes</small></div></p>';  
}

echo '<input type="submit" name="submit" value="Save"/></form>';
echo '<p><a href="'.$root.'office.php?a=anketa&amp;id='.$pr.'">'.$lang['go_anketa'].'</a></p>';
echo '</div>';
    
}else{
    echo '<div class="small"><a href="'.$root.'office.php"><span class="red">ERROR! User not exist`s!</span></a></div>';
}

}else{
    echo '<div class="small"><a href="'.$root.'office.php"><span class="red">ERROR! User ID not exist`s!</span></a></div>';
}
break;



}

include($root.'system/foot.php');

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */

?>